<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $this->display();
    }
    public function login(){
        $this->display();
    }
    function checkLogin()
    {
            $Admin=M(Admin);
            $login['name']=I('post.name');
             $login['password']=I('post.password');
             $re=$Admin->where($login)->find();
             if ($re!="") {
                $this->success("登陆成功，正在跳转>>>>",U('Index/index'));

             }
             else{
                $this->error("登陆失败，请重新填写密码>>>>",U('Index/login'));
             }
    }
     public function pass(){
      
        $this->display();
    }
    function editPass()
    {
       
            $edit=M('admin');
            $map['name']="fengke";
            $map['password']=I('post.mpass');
            $re=$edit->where($map)->find();
            var_dump($re);
            if ($re!=null) {
              $pass['password']=I('post.newpass');
              $where['name']="fengke";
              $re1=$edit->where($where)->setField($pass);
              var_dump($re1);
              var_dump(I('post.newpass'));
              if ($re1!="") {
                 
                  $this->success("修改成功",U('Orders/showList'));
              }
              else{
             $this->error("修改失败",U('Index/pass'));
              }
            }
            else{
                 $this->error("原始密码错误",U('Index/pass'));
            } 
    }
    public function showList()
    {
        $this->display();
    }

}
